import { Component, ComputedOptions, Directive, MethodOptions, h, render } from "vue";

const load = (component: Component<any, any, any, ComputedOptions, MethodOptions>): Directive<any, any> => {
    const vNode = h(component);
    return (el, { value }) => {
        value ? (render(vNode, el), el.append(vNode.el)) : vNode.el && el.removeChild(vNode.el);
    };
};
export default load;
